package com.hu.video.controller;

import com.hu.video.entity.VideoVisibility;
import com.hu.video.service.IVideoVisibilityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/video/visibility")
public class VideoVisibilityController {
    @Autowired
    private IVideoVisibilityService service;

    @GetMapping("/{videoId}")
    public VideoVisibility getVisibility(@PathVariable Long videoId) {
        return service.getByVideoId(videoId);
    }

    @PostMapping("/set")
    public String setVisibility(@RequestBody VideoVisibility visibility) {
        service.setVisibility(visibility);
        return "success";
    }
} 